//
//  TYHKnowlegeViewController.m
//  OpenPractice
//
//  Created by tanyuehong on 16/2/29.
//  Copyright © 2016年  lijinghua. All rights reserved.
//

#import "SCCustomButton.h"
#import "PracticeViewController.h"


@interface PracticeViewController ()


@property (nonatomic,strong) UIView *praticeTag;


@end

@implementation PracticeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navgationBar.barType = OPNavgationBarTypePractice;
    self.view.backgroundColor = kOPSeparateBackgroundColor;
    [self.view addSubview:self.praticeTag];
    [self requstPraticeHomeData];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)refresh {
   
}

- (void)requstPraticeHomeData {
    [TYHHTTPFacade doHttpRequest:@"https://www.redskt.com/api/home/pratice/index" parms:nil completeBlock:^(NSError *error, NSDictionary *data) {
        
    }];
}



- (UIView *)praticeTag {
    if (!_praticeTag) {
        _praticeTag = [[UIView alloc] initWithFrame:CGRectMake(0, kNavigationBarBottom+10, self.view.width, 180)];
        _praticeTag.backgroundColor = [UIColor whiteColor];
        
        CGFloat btnWidth = 70;
        CGFloat jianxi   = 15;
        for (NSInteger i=0; i<6; i++) {
            SCCustomButton *progress = [[SCCustomButton alloc] init];
            [progress setImage:[UIImage imageNamed:@"pratice_home_all"] forState:UIControlStateNormal];
            progress.titleLabel.font = [UIFont systemFontOfSize:12];
            [progress setTitle:@"全部" forState:UIControlStateNormal];
            progress.imagePosition = SCCustomButtonImagePositionTop;
            [progress setTitleColor:kTYH333333TextColor forState:UIControlStateNormal];
            progress.interTitleImageSpacing = 4;
    
            CGFloat lefte = (self.view.width-btnWidth*4-jianxi*3)/2;
            progress.frame = CGRectMake(lefte+(i%4)*btnWidth+(i%4)*jianxi, 80*(i/4), btnWidth, 90);
            NSString *log =  NSStringFromCGRect(progress.frame);
            NSLog(@"===%@",log);
            [_praticeTag addSubview:progress];
        }
    }
    return _praticeTag;
}

@end
